<?php
$registrmodel = new RegistrationForm;


if (!isset($model))
    $model = new UserLogin();
?>
<div class="container">
    <div class="row">
        <div class="span12"> 
            <div class="padding20px whiteBg">           	
                <h3 class="addmarginB20 remmargin"><p id="txtIdLgnRgr">Login</p></h3>
                <div class="common whiteBg greenBor">
                    <div class="padding20px">                        	
                        <a href="<?php echo baseUrl().'user/user/login/'.Message::FACEBOOK_URL; ?>" class="fbLogin"><img src="<?php echo ThemePath(); ?>/images/sm-fb-btn.gif"></a> 
                        <a href="<?php echo Message::GOOGLE_URL; ?>" class="gmailLogin"><img src="<?php echo ThemePath(); ?>/images/sm-g-btn.jpg"></a>
                    </div>                    	
                </div>

                <div id="loginDivId">
                    <div class="userElements">
                        <div class="common whiteBg">
                            <div id="activatestatus" style="display: none; color:#009933">You have successfully activated, Please login.</div>
                            <div id="UserLogin_status_em_" style="display:none; color:#FF0000;"></div>
                            <div class="lg-col">
                                <?php
                                $form = $this->beginWidget('GxActiveForm', array(
                                    'id' => 'loginpop-form',
                                    'action' => Yii::app()->createUrl('user/user/loginpop'),
                                    'enableClientValidation' => true,
                                    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => true, 'enableAjaxValidation' => true,
                                        'htmlOptions' => array('class' => 'remmarginB'),
                                    ),
                                        ));
                                ?>
                                <fieldset>
                                    <div class="common">
                                        <div class="col col1">
                                            <label>Username / Email ID <span class="required">*</span></label>
                                            <?php echo CHtml::activeTextField($model, 'username', array('class' => 'field')) ?>
                                            <div id="UserLogin_username_em_" style="display:none; color:#FF0000;"></div>
                                        </div>
                                        <div class="col col2">
                                            <label>Password <span class="required">*</span></label>
                                            <?php echo CHtml::activePasswordField($model, 'password', array('class' => 'field')) ?>
                                            <div id="UserLogin_password_em_" style="display:none;color:#FF0000;"></div>
                                        </div>
                                        <div class="clear"></div>                                            
                                    </div>
                                   <!--<p class="addmarginB20"><a href="#">Forgot Password?</a></p>-->
                                    <?php
                                    echo CHtml::ajaxSubmitButton('Submit', CHtml::normalizeUrl(array('user/user/loginpop')), array(
                                        'dataType' => 'json',
                                        'type' => 'post',
                                        'success' => 'function(data) {
                        $("#AjaxLoaderLogin").hide();
                        if(data.status=="success"){
								parent.$("#MakeQuery_users_id").val(data.uid);
								parent.$("#MakeQuery_name").val(data.name);
								parent.$("#MakeQuery_email").val(data.email);
								parent.$("#makeQId").css("display","none"); 
								parent.$("#makeQIdok").show(); 
								window.parent.$("#makeQIdok").trigger("click");
							var magnificPopup = $.magnificPopup.instance; 
							magnificPopup.close(); 
                        } else{
							$.each(data, function(key, val) { 
								$("#"+key+"_em_").text(val);                                                    
								$("#"+key+"_em_").show();
                        });
                        }
                    }',
                                        'beforeSend' => 'function(){                        
                           $("#AjaxLoaderLogin").show();
                      }'
                                            ), array('class' => 'btn twoBtn', 'name' => 'loginpop', 'id' => 'loginpop'));
                                    ?>
                                    <a href="javascript:void(0);" onclick="showLoginregister('register');" class="btn">Need an account? Sign Up</a><span id="AjaxLoaderLogin" style="display:none;"><img src="<?php echo ThemePath(); ?>/images/ajax-loader-mini.gif"></span>
									<a class="floatR addmarginT10" href="javascript:void(0);" onclick="return showLoginregister('changepass');">Forgot Password?</a>
                                </fieldset>
                                <?php
                                $this->endWidget();
                                ?>


                            </div>                    	
                        </div>               
                    </div>    
                </div>

                <div id="RegisterDivId" style="display:none;">
                    <?php Yii::app()->getModule('user');
                    $this->renderPartial('application.modules.user.views.user.registrationpop'); ?>
                </div>                    	
            </div>
        </div>
    </div>       		
</div>
</div>
</div>